class AddConplexIndex < ActiveRecord::Migration
  def self.up
    add_index :asin_infos, [:contents_type, :title_rank, :author_id], :name => "index_asin_infos_on_ct_and_tr_and_aid"
    add_index :asin_infos, [:publisher_id, :contents_type, :title_rank, :author_id], :name => "index_asin_infos_on_pid_and_ct_and_tr_and_aid"
    add_index :asin_infos, [:contents_type, :title_rank, :genre], :name => "index_asin_infos_on_ct_and_tr_and_gen"
    add_index :asin_infos, [:number_ofclicks_rank, :contents_type,:sales_rank,:author_id], :name => "index_asin_infos_on_ncr_and_ct_and_sr_and_aid"
  end

  def self.down
    remove_index :asin_infos, :name => "index_asin_infos_on_ct_and_tr_and_aid"
    remove_index :asin_infos, :name => "index_asin_infos_on_pid_and_ct_and_tr_and_aid"
    remove_index :asin_infos, :name => "index_asin_infos_on_ct_and_tr_and_gen"
    remove_index :asin_infos, :name => "index_asin_infos_on_ncr_and_ct_and_sr_and_aid"
  end
end
